/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.hcsc.datapower.CMDB.common;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author I307211
 */
public class CMDBException extends Exception{
    private static final int DB_ERROR = 1;
    private static final int LOGIN_ERROR = 2;
    private static final int BAD_CREDENTIALS = 3;
    
    
    
    private static final String UNKNOWN_ERROR = "General application error";
    private static final String DB_ERROR_MSSG = "Unable to connect to the database.";
    private static final String LOGIN_ERROR_MSSG = "Username and/or Password can not be empty!";
    private static final String BAD_CREDENTIALS_MSSG = "Incorrect username or password. Try again!";
    
    private static final int WARNING_ICON = 1;
    private static final int ERROR_ICON = 2;
    
    private JOptionPane errorPane;
    
    public CMDBException(String mssg){
        super(mssg);
    }
    
    public CMDBException(int eType){
        
    }
    
    public CMDBException(int eType, JFrame parent){
        switch(eType){
            case DB_ERROR:  displayErrorPane(DB_ERROR_MSSG, parent);
            case LOGIN_ERROR : displayErrorPane(LOGIN_ERROR_MSSG, parent);
            case BAD_CREDENTIALS : displayErrorPane(BAD_CREDENTIALS_MSSG, parent);
           // case default:  displayDialog(UNKNOWN_ERROR, parent);
        }
        
    }
    
    private void displayErrorPane(String mssg, JFrame parent){
        
    }
}
